//
//  LSZPublicDataManager.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/9/3.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZPublicDataManager.h"

@implementation LSZPublicDataManager

+ (instancetype)sharedInstance {
    
    static LSZPublicDataManager *instance;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        // 子类调用父类的实例化的方法
        instance = [self new];
    });
    
    return instance;
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self loadurlImage];
        [self loadId_id];
        [self loadName];
        [self loadSummary];
        [self loadVillageID];
        [self loadVillageIDState];
    }
    return self;
}
-(void)setVillageIDState:(NSString *)villageIDState
{
    _villageIDState = villageIDState;
    [[NSUserDefaults standardUserDefaults] setObject:villageIDState forKey:@"villageIDState"];
}
-(void)loadVillageIDState
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"villageIDState"] == nil) {
        self.villageIDState = @"";
    } else {
        self.villageIDState = [[NSUserDefaults standardUserDefaults] objectForKey:@"villageIDState"];
    }
}
-(void)setVillageID:(NSString *)villageID
{
    _villageID = villageID;
    [[NSUserDefaults standardUserDefaults] setObject:villageID forKey:@"villageID"];
}
-(void)loadVillageID
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"villageID"] == nil) {
        self.villageID = @"";
    } else {
        self.villageID = [[NSUserDefaults standardUserDefaults] objectForKey:@"villageID"];
    }
}
-(void)setLeaf:(NSString *)leaf
{
    _leaf = leaf;
    [[NSUserDefaults standardUserDefaults] setObject:leaf forKey:@"leaf"];
}
///读取usercode
-(void)loadurlImage{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"leaf"] == nil) {
        self.leaf = @"";
    } else {
        self.leaf = [[NSUserDefaults standardUserDefaults] objectForKey:@"leaf"];
    }
}
-(void)setId_id:(NSString *)id_id
{
    _id_id = id_id;
    [[NSUserDefaults standardUserDefaults] setObject:id_id forKey:@"id_id"];
}
///读取usercode
-(void)loadId_id{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"id_id"] == nil) {
        self.id_id = @"";
    } else {
        self.id_id = [[NSUserDefaults standardUserDefaults] objectForKey:@"id_id"];
    }
}


-(void)setName:(NSString *)name
{
    _name = name;
    [[NSUserDefaults standardUserDefaults] setObject:name forKey:@"name"];
}
///读取usercode
-(void)loadName{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"name"] == nil) {
        self.name = @"";
    } else {
        self.name = [[NSUserDefaults standardUserDefaults] objectForKey:@"name"];
    }
}

-(void)setSummary:(NSString *)summary
{
    _summary = summary;
    [[NSUserDefaults standardUserDefaults] setObject:summary forKey:@"summary"];
}
///读取usercode
-(void)loadSummary{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"summary"] == nil) {
        self.summary = @"";
    } else {
        self.summary = [[NSUserDefaults standardUserDefaults] objectForKey:@"summary"];
    }
}
@end
